<?php
$fn = '/user/upload/wx.php';
echo pathinfo($fn, PATHINFO_EXTENSION), '<br>'; //扩展名 php
echo pathinfo($fn, PATHINFO_FILENAME), '<br>';//文件名wx
echo pathinfo($fn, PATHINFO_DIRNAME), '<br>';//目录名 /user/upload
echo pathinfo($fn, PATHINFO_BASENAME), '<br>';//wx.php

echo basename($fn), '<br>';//wx.php
echo basename($fn, '.php'), '<br>'; //wx
echo dirname($fn), '<br>';//user/upload

echo realpath('.'), '<br>';
echo $_SERVER['DOCUMENT_ROOT'], '<br>';

//E:\pspro\php24\ch08\iodemo.php
echo __FILE__, '<br>';
//E:\pspro\php24\ch08\iodemo.php
echo $_SERVER['SCRIPT_FILENAME'], '<br>';

///php24/ch08/iodemo.php
echo $_SERVER['SCRIPT_NAME'], '<br>';

echo '<pre>';
print_r(pathinfo($fn));


